package com.muapet.service;

import com.muapet.model.Account;
import com.muapet.model.User;
import com.muapet.model.other.Pagination;

import java.util.List;

public interface IUserService {
	User login(String loginname, String password);

	User findById(Integer id);

	/**
	 * 非自己查询时使用，处理敏感字段
	 * 
	 * @param id
	 * @return
	 */
	User findShowUserById(Integer id);

	List<User> findAll(Pagination pagination);

	Integer countAll();

	List<User> findByLoginname(String loginname, Pagination pagination);

	Integer countByLoginname(String loginname);
	
	List<User> findWaitingUser(Pagination pagination);

	Integer countWaitingUser();

	User add(User user);

	Integer update(User user);

	boolean checkSameLoginname(String loginname);

	Account findAccountByUserId(Integer userId);

	/**
	 * 修改支付密码，若无支付信息则新建
	 * 
	 * @param userId
	 * @param newPassword
	 * @return
	 */
	Account updateAccountPwdByUserId(Integer userId, String newPassword);

	Integer updatePwdByUserId(Integer userId, String newPassword);

	Integer updateAccountByUserId(Integer userId, Double money, Boolean isAdd);
	
	Integer delete(Integer id);

}
